import request from '@/utils/request'

// 查询缺陷类型列表
export function listDefecttype(query) {
  return request({
    url: '/basic/defecttype/list',
    method: 'get',
    params: query
  })
}

// 查询缺陷类型列表
export function listInfo(query) {
  return request({
    url: '/basic/defecttype/listInfo',
    method: 'get',
    params: query
  })
}


// 查询缺陷类型详细
export function getDefecttype(defectId) {
  return request({
    url: '/basic/defecttype/' + defectId,
    method: 'get'
  })
}

// 新增缺陷类型
export function addDefecttype(data) {
  return request({
    url: '/basic/defecttype',
    method: 'post',
    data: data
  })
}

// 修改缺陷类型
export function updateDefecttype(data) {
  return request({
    url: '/basic/defecttype',
    method: 'put',
    data: data
  })
}

// 删除缺陷类型
export function delDefecttype(defectId) {
  return request({
    url: '/basic/defecttype/' + defectId,
    method: 'delete'
  })
}



// 查询缺陷列表（排除节点）
export function listDefectExcludeChild(deptId) {
  return request({
    url: '/basic/defecttype/list/exclude/' + deptId,
    method: 'get'
  })
}


// 查询部门下拉树结构
export function treeselect() {
  return request({
    url: '/basic/defecttype/treeselect',
    method: 'get'
  })
}

// 更改状态
export function changeDefectStatus(defectId, status) {
  const data = {
    defectId,
    status
  }
  return request({
    url: '/basic/defecttype/changeStatus',
    method: 'put',
    data: data
  })
}
